package ch.sfug.anim.tween.color {
	import flash.display.DisplayObject;
	import flash.geom.ColorTransform;
	
	import ch.sfug.anim.tween.color.AbstractColorTween;
	import ch.sfug.util.RGB;		

	/**
	 * @author Administrator
	 */
	public class DisplayObjectColorTween extends AbstractColorTween {
		
		private var t:DisplayObject;

		public function DisplayObjectColorTween( dis:DisplayObject, d:Number ) {
			super( d );
			this.t = dis;
		}
		
		protected override function getStartColor():RGB {
			return RGB.createFromNumber( t.transform.colorTransform.color );
		}
		
		
		public override function apply( rgb:RGB ):void {
			var c:ColorTransform = new ColorTransform();
			c.color = rgb.number;
			t.transform.colorTransform = c;
		}
	}
}
